package cn.edu.scau.cmi.yangjiamin.composite.consistent;

import java.util.concurrent.CopyOnWriteArrayList;
import java.util.List;

public abstract class OrganizationComponent {
	protected String name;
	protected OrganizationComposite father;//节点的父亲
	protected List<OrganizationComponent> child = new CopyOnWriteArrayList<OrganizationComponent>();
	
	public OrganizationComponent() {
		
	}
	
	public OrganizationComponent(String name, OrganizationComposite father) {//设置父节点只能通过构造器
		this.name = name;
		this.father = father;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	
	public OrganizationComposite getFather() {
		return father;
	}
	
	public abstract List<OrganizationComponent> getChild();

	public abstract boolean add(OrganizationComponent oc);

	public abstract boolean remove(OrganizationComponent oc);
	
	public abstract String display() ;
	

	
	
}
